home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 120
/
Vol 120.iso
/
games
/
anacroz.swf
/
scripts
/
DefineSprite_1731
/
frame_1
/
DoAction_2.as
next >
Wrap
Text File
|
2010-11-09
|
6KB
|
178 lines
if(onPress == undefined)
{
onPress = function()
{
_root.it_selx = _X;
_root.it_sely = _Y;
if(_name == "item")
{
if(_currentframe > 1)
{
this.useHandCursor = true;
_root.it_depth = _parent.getDepth();
_parent.swapDepths(_root.getNextHighestDepth());
startDrag(this,0,-1 * _parent._x,-50,560 - _parent._x,60);
}
}
else if(_name.length <= 4)
{
_root.it_depth = this.getDepth();
this.swapDepths(_root.getNextHighestDepth());
startDrag(this,0,20,170,690,450);
}
};
onReleaseOutside = function()
{
stopDrag();
if(_name == "item")
{
_parent.swapDepths(_root.it_depth);
this.useHandCursor = false;
}
else
{
this.swapDepths(_root.it_depth);
}
_X = _root.it_selx;
_Y = _root.it_sely;
};
onRelease = function()
{
_root.fx.attachSound("pagamento");
if(_name == "item")
{
_parent.swapDepths(_root.it_depth);
if(this.hitTest(_root.venda))
{
var _loc4_ = _parent._name.substr(4);
_root.edFundos = Number(_root.edFundos) + Math.round(_root.it_valores[this._currentframe - 2][4] * 0.8);
_root.client.removeItem(_loc4_ - 1);
_root.fx.start();
_root.venda.play();
}
}
else
{
this.swapDepths(_root.it_depth);
if(this.hitTest(_root.item1))
{
if(_root.checkItem(_root.client,this._currentframe - 2))
{
if(_root.item1.item._currentframe == 1)
{
if(_root.it_valores[this._currentframe - 2][4] <= _root.edFundos)
{
_root.client.addItem(_name.substr(2) - 1);
_root.edFundos -= _root.it_valores[this._currentframe - 2][4];
_root.fx.start();
}
else
{
_root.showAlert("Não há fundos suficientes para comprar este item!");
}
}
}
else
{
_root.showAlert("Este soldado não pode usar este tipo de item!");
}
}
else if(this.hitTest(_root.item2))
{
if(_root.checkItem(_root.client,this._currentframe - 2))
{
if(_root.item2.item._currentframe == 1)
{
if(_root.it_valores[this._currentframe - 2][4] <= _root.edFundos)
{
_root.client.addItem(_name.substr(2) - 1);
_root.edFundos -= _root.it_valores[this._currentframe - 2][4];
_root.fx.start();
}
else
{
_root.showAlert("Não há fundos suficientes para comprar este item!");
}
}
}
else
{
_root.showAlert("Este soldado não pode usar este tipo de item!");
}
}
else if(this.hitTest(_root.item3))
{
if(_root.checkItem(_root.client,this._currentframe - 2))
{
if(_root.item3.item._currentframe == 1)
{
if(_root.it_valores[this._currentframe - 2][4] <= _root.edFundos)
{
_root.client.addItem(_name.substr(2) - 1);
_root.edFundos -= _root.it_valores[this._currentframe - 2][4];
_root.fx.start();
}
else
{
_root.showAlert("Não há fundos suficientes para comprar este item!");
}
}
}
else
{
_root.showAlert("Este soldado não pode usar este tipo de item!");
}
}
else if(this.hitTest(_root.item4))
{
if(_root.checkItem(_root.client,this._currentframe - 2))
{
if(_root.item4.item._currentframe == 1)
{
if(_root.it_valores[this._currentframe - 2][4] <= _root.edFundos)
{
_root.client.addItem(_name.substr(2) - 1);
_root.edFundos -= _root.it_valores[this._currentframe - 2][4];
_root.fx.start();
}
else
{
_root.showAlert("Não há fundos suficientes para comprar este item!");
}
}
}
else
{
_root.showAlert("Este soldado não pode usar este tipo de item!");
}
}
else if(this.hitTest(_root.item5))
{
if(_root.checkItem(_root.client,this._currentframe - 2))
{
if(_root.item5.item._currentframe == 1)
{
if(_root.it_valores[this._currentframe - 2][4] <= _root.edFundos)
{
_root.client.addItem(_name.substr(2) - 1);
_root.edFundos -= _root.it_valores[this._currentframe - 2][4];
_root.fx.start();
}
else
{
_root.showAlert("Não há fundos suficientes para comprar este item!");
}
}
}
else
{
_root.showAlert("Este soldado não pode usar este tipo de item!");
}
}
}
stopDrag();
_X = _root.it_selx;
_Y = _root.it_sely;
};
}